package com.photoeditor.demo.model.subscribe.strategy;

import android.support.annotation.NonNull;

import com.common.commercialize.strategy.bean.RateStrategyBean;
import com.common.commercialize.strategy.bean.StrategyBean;

import org.json.JSONObject;


/**
 * Author：ZFashion
 * Created Time: 2019.05.30
 */
public class RateNewStrategyBean extends StrategyBean<RateNewStrategyBean.RateNewStrategyBeanConfig> {

    @Override
    protected RateNewStrategyBeanConfig makeConfig(@NonNull JSONObject jsonObject) {
        return RateNewStrategyBeanConfig.make(jsonObject);
    }

    public static class RateNewStrategyBeanConfig extends RateStrategyBean.RateStrategyBeanConfig {
        public static final String RATE_TYPE = "rate_type";
        private int mRateType;

        public static final String CLOSE_TIME = "close_time";
        private int mCloseTime;

        public int getRateType() {
            return mRateType;
        }

        public void setRateType(int rateType) {
            mRateType = rateType;
        }

        public int getCloseTime() {
            return mCloseTime;
        }

        @Override
        protected void analysis(@NonNull JSONObject jsonObject) {
            super.analysis(jsonObject);
            mRateType = jsonObject.optInt(RATE_TYPE, 0);
            mCloseTime = jsonObject.optInt(CLOSE_TIME, 1);
        }

        public static RateNewStrategyBeanConfig make(@NonNull JSONObject jsonObject) {
            RateNewStrategyBeanConfig config = new RateNewStrategyBeanConfig();
            config.analysis(jsonObject);
            return config;
        }
    }
}
